package com.wn.icloud.provider.uac.remote;

import com.wn.icloud.common.authority.PermissionInfo;
import com.wn.icloud.common.exception.BaseException;
import com.wn.icloud.common.msg.ObjectRestResponse;
import com.wn.icloud.common.msg.TableResultResponse;
import com.wn.icloud.common.util.user.JwtAuthenticationRequest;
import com.wn.icloud.common.vo.user.UserInfo;
import com.wn.icloud.provider.uac.remote.fallback.UserFeignApiFallback;
import com.wn.icloud.provider.uac.remote.vo.LoginReqVO;
import com.wn.icloud.provider.uac.remote.vo.ResetUserPassWordReqVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author Rainer
 * @create 2017-06-21 8:11
 */
@FeignClient(value = "icloud-provider-uac", contextId = "user", fallback = UserFeignApiFallback.class)
public interface UserFeignApi {

    @GetMapping(value = "/api/user/un/{username}/permissions")
    List<PermissionInfo> getPermissionByUsername(@PathVariable("username") String username);

    @GetMapping(value = "/api/permissions")
    List<PermissionInfo> getAllPermissionInfo();

    @PostMapping(value = "/api/user/validate")
    UserInfo validate(@RequestBody JwtAuthenticationRequest authenticationRequest);

    @GetMapping(value = "/api/api/user/getUserlist")
    TableResultResponse getUserlist(@RequestParam("page") Integer page,@RequestParam("size") Integer size);

    @GetMapping(value = "/api/api/user/getUserInfo")
    UserInfo getUserInfo(@RequestParam("userid") String userid);

    /**
     * 用户登录--手机号密码
     */
    @PostMapping(value = "/api/login")
    UserInfo login(@RequestBody LoginReqVO loginReqVO);


    @PostMapping(value = "/api/loginPhone")
    UserInfo loginPhone(@RequestBody LoginReqVO loginReqVO);

    @PostMapping(value = "/api/resetUserPassWord")
    ObjectRestResponse resetUserPassWord(@RequestBody ResetUserPassWordReqVO resetUserPassWordReqVO);
}
